import request from "@/utils/axios";
// 获取所有角色
const getRoleListServe = query => {
  return request.get("/systemRole/getRoleList", query);
};
// 获取账户列表
const accountListServe = query => {
  return request.get("/systemUser/queryPage", query);
};
// 新增用户
const accountApiAddServe = query => {
  return request.post("/systemUser/createUser", query);
};
// 删除账户
const accountDelServe = query => {
  return request.get(`/system/delete/${query}`, {});
};
// 启用/禁用账户
const accountUpdateStatusServe = query => {
  return request.get("/system/updateStatus", query);
};
// 重置密码
const resetPassword = query => {
  return request.post("/systemUser/resetPassword", query);
};
// 根据id查询账号
const accountSelectRoleServe = query => {
  return request.get("/system/getSelectRoleList", query);
};
// 根据id查询账号,修改用户
const update = query => {
  return request.get("/systemUser/updateUser", query);
};
// 获取角色管理列表
const getPageRoleList = query => {
  return request.get("/systemRole/getRoleList", query);
};
// 新增角色
const roleApiAddServe = query => {
  return request.get("/systemRole/createRole", query);
};
// 修改角色
const roleApiUpdate = query => {
  return request.get("/systemRole/updateRole", query);
};
// 删除角色
const roleApiDeleteServe = query => {
  return request.get(`/systemRole/delete/${query}`, {});
};
// 全部列表
// 传入角色id 则查询当前角色绑定的权限
const permissionNavigationListServe = query => {
  return request.get(`/systemMenu/getMenuList`, query);
};
// 查询当前角色绑定的权限
const permissionHasBindServe = query => {
  return request.get(`/permissionBindApi/getData/${query}`, {});
};
// 绑定权限按钮
const addDutyNavBindingServe = query => {
  return request.get(`/systemRole/grantMenu`, query);
};
export default {
  getRoleListServe,
  accountListServe,
  accountApiAddServe,
  accountDelServe,
  accountUpdateStatusServe,
  accountSelectRoleServe,
  update,
  getPageRoleList,
  roleApiAddServe,
  roleApiUpdate,
  roleApiDeleteServe,
  permissionNavigationListServe,
  permissionHasBindServe,
  addDutyNavBindingServe,
  resetPassword
};
